home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-09-14 | 19.0 KB | 359 lines | [TEXT/MPS ] |
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- ;• •
- ;• File Name: Parasite.a •
- ;• ---------- •
- ;• •
- ;• Copyright © 1989 Apple Computer, Inc. All Rights Reserved •
- ;• •
- ;• Description •
- ;• ----------- •
- ;• This file contains the assembly language routines of the SLUDGE •
- ;• parasite. •
- ;• •
- ;• History •
- ;• ------- •
- ;• •
- ;• Author Date Description •
- ;• ------------------------------------------------------------------ •
- ;• Kevin McEntee 2/20/90 Original Implementation •
- ;• •
- ;• •
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
-
-
- INCLUDE 'traps.a'
- INCLUDE 'ToolEqu.a'
- EXPORT ATRAP_EX:CODE
- EXPORT TAKE_A_TRAP_EXCEPTION_VECTOR:CODE
- EXPORT TAKE_JUMP_TRACE_VECTOR:CODE
- IMPORT HLL_ATRAP_EX:CODE
- EXPORT MASTER_A_TRAP:CODE
- EXPORT GET_MASTER_A_TRAP_HANDLE:CODE
- EXPORT GET_SAVED_A_TRAP_VECTOR:CODE
- EXPORT SET_JUMP_TRACE_BIT:CODE
- EXPORT CLEAR_JUMP_TRACE_BIT:CODE
- SEG 'NUGG'
-
-
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- ;• •
- ;• Identifier: MASTER_SLUDGE •
- ;• ----------- •
- ;• •
- ;• Description •
- ;• ----------- •
- ;• This function is never executed. It is a place for a DC.L that •
- ;• contains the current SLUDGE factor. There are access routines for •
- ;• this DC.L later in this file. •
- ;• •
- ;• History •
- ;• ------- •
- ;• •
- ;• Author Date Description •
- ;• ------------------------------------------------------------------ •
- ;• Kevin McEntee 2/20/90 Original Implementation •
- ;• •
- ;• •
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
- MASTER_SLUDGE PROC
- Jmp skipper
- DC.L 0
- skipper Pea #'How dare you disturb the sludge MASTER! Use the g command NOW!'
- _DebugStr
- RTS
- ENDPROC
-
-
-
-
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- ;• •
- ;• Identifier: GET_SAVED_SLUDGE_FACTOR •
- ;• ----------- •
- ;• •
- ;• Description •
- ;• ----------- •
- ;• This function returns the current SLUDGE factor in register D0. •
- ;• •
- ;• History •
- ;• ------- •
- ;• •
- ;• Author Date Description •
- ;• ------------------------------------------------------------------ •
- ;• Kevin McEntee 2/20/90 Original Implementation •
- ;• •
- ;• •
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
- GET_SAVED_SLUDGE_FACTOR PROC
- Move.L A0,-(A7)
- Lea MASTER_SLUDGE,A0
- AddQ.L #4,A0
- Move.L (A0),D0
- Move.L (A7)+,A0
- RTS
- ENDPROC
-
-
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- ;• •
- ;• Identifier: ATRAP_EX •
- ;• ----------- •
- ;• •
- ;• Description •
- ;• ----------- •
- ;• This proc is executed at each a-trap exception. SLUDGE needs •
- ;• control here because the exception turns off the jump-trace bit •
- ;• and SLUDGE needs to turn it back on. So SLUDGE turns it back on •
- ;• and jumps to the system a-trap dispatcher. •
- ;• •
- ;• History •
- ;• ------- •
- ;• •
- ;• Author Date Description •
- ;• ------------------------------------------------------------------ •
- ;• Kevin McEntee 2/20/90 Original Implementation •
- ;• •
- ;• •
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
- ATRAP_EX PROC
- Pea #0
- MoveM.L A0-A7/D0-D7,-(A7)
- Link A6,#0
- Move.L A6,-(SP)
- Pea 72(A6) ; pass the address of the stack frame
- Move.L A0,-(A7)
- Jsr HLL_ATRAP_EX
- MoveA.L 8(SP),A6
- Move.L D0,68(A6) ; the address of the system a-trap dispatcher will be on the top of the stack
- Unlk A6
- MoveM.L (A7)+,A0-A7/D0-D7
- Ori.W #$4000,SR ; set jump trace bit
- RTS
- ENDPROC
-
-
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- ;• •
- ;• Identifier: JTRACE_EX •
- ;• ----------- •
- ;• •
- ;• Description •
- ;• ----------- •
- ;• This proc is executed at each jump trace exception. It simply •
- ;• executes a tight loop the number of times specified by the current •
- ;• SLUDGE factor. •
- ;• •
- ;• History •
- ;• ------- •
- ;• •
- ;• Author Date Description •
- ;• ------------------------------------------------------------------ •
- ;• Kevin McEntee 2/20/90 Original Implementation •
- ;• •
- ;• •
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
- JTRACE_EX PROC
- Move.L D0,-(A7)
- JSR GET_SAVED_SLUDGE_FACTOR
- back DBF D0,back ; loop here
- Move.L (A7)+,D0
- OrI.W #$4000,(A7) ; set jump trace bit in stacked status register
- RTE
- ENDPROC
- ;••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- ;• •
- ;• Function Name •
- ;• ------------- •
- ;• TAKE_A_TRAP_EXCEPTION_VECTOR •
- ;• •
- ;• Purpose •
- ;• ------- •
- ;• This PROC will replace the a-trap exception vector with address of the •
- ;• ATRAP_EX PROC •
- ;• •
- ;• •
- ;• Modification History •
- ;• -------------------- •
- ;• •
- ;• Name Date Change •
- ;• ---- ---- ------ •
- ;• Kevin McEntee 9/21/88 Original implementation •
- ;• •
- ;••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- TAKE_A_TRAP_EXCEPTION_VECTOR PROC
- Move.L A0,-(A7)
- Move.L A1,-(A7)
- MoveA.L #$28,A0 ; A0 -> A-trap exception vector
- Lea ATRAP_EX,A1 ; A1 -> my exception handler
- Move.L A1,(A0) ; replace existing exception vector
- MoveA.L (A7)+,A1
- MoveA.L (A7)+,A0
- RTS
- ENDPROC
-
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- ;• •
- ;• Identifier: TAKE_JUMP_TRACE_VECTOR •
- ;• ----------- •
- ;• •
- ;• Description •
- ;• ----------- •
- ;• This proc accepts a SLUDGE factor as a parameter and saves it as •
- ;• current SLUDGE factor and sets the jump-trace exception vector to •
- ;• to JTRACE_EX. •
- ;• •
- ;• History •
- ;• ------- •
- ;• •
- ;• Author Date Description •
- ;• ------------------------------------------------------------------ •
- ;• Kevin McEntee 2/20/90 Original Implementation •
- ;• •
- ;• •
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
- TAKE_JUMP_TRACE_VECTOR PROC
- ;
- Move.L A0,-(A7)
- Move.L A1,-(A7)
- Move.L D0,-(A7)
- Lea MASTER_SLUDGE,A0
- AddQ.L #4,A0
- Move.L 16(SP),D0
- Move.L D0,(A0) ; save current SLUDGE factor
- ;
- MoveA.L #$24,A0 ; A0 -> trace exception vector
- Lea JTRACE_EX,A1 ; A1 -> my exception handler
- Move.L A1,(A0) ; replace existing exception vector
- ;
- ; ; put RA on top of stack
- MoveA.L 12(SP),A1
- Move.L A1,16(SP)
- ;
- Move.L (A7)+,D0
- MoveA.L (A7)+,A1
- MoveA.L (A7)+,A0
- AddA.L #4,A7
- RTS
- ENDPROC
-
-
-
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- ;• •
- ;• Identifier: MASTER_A_TRAP •
- ;• ----------- •
- ;• •
- ;• Description •
- ;• ----------- •
- ;• This function is never executed. It is a place for a DC.L that •
- ;• contains the system value for the a-trap exception vector. There •
- ;• are access routines for this DC.L later in this file. •
- ;• •
- ;• History •
- ;• ------- •
- ;• •
- ;• Author Date Description •
- ;• ------------------------------------------------------------------ •
- ;• Kevin McEntee 2/20/90 Original Implementation •
- ;• •
- ;• •
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
- MASTER_A_TRAP PROC
- Jmp around
- DC.L 0
- around Pea #'How dare you disturb the a_trap MASTER! Use the g command NOW!'
- _DebugStr
- RTS
- ENDPROC
-
-
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- ;• •
- ;• Identifier: GET_MASTER_A_TRAP_HANDLE •
- ;• ----------- •
- ;• •
- ;• Description •
- ;• ----------- •
- ;• This returns the address of the DC.L of the MASTER_A_TRAP in •
- ;• register D0. •
- ;• •
- ;• History •
- ;• ------- •
- ;• •
- ;• Author Date Description •
- ;• ------------------------------------------------------------------ •
- ;• Kevin McEntee 2/20/90 Original Implementation •
- ;• •
- ;• •
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
- GET_MASTER_A_TRAP_HANDLE PROC
- Move.L A0,-(A7)
- Lea MASTER_A_TRAP,A0
- Move.L A0,D0
- AddQ.L #4,D0
- Move.L (A7)+,A0
- RTS
- ENDPROC
-
-
-
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- ;• •
- ;• Identifier: GET_SAVED_A_TRAP_VECTOR •
- ;• ----------- •
- ;• •
- ;• Description •
- ;• ----------- •
- ;• This returns the saved a-trap execption vector in register DO. •
- ;• •
- ;• History •
- ;• ------- •
- ;• •
- ;• Author Date Description •
- ;• ------------------------------------------------------------------ •
- ;• Kevin McEntee 2/20/90 Original Implementation •
- ;• •
- ;• •
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
- GET_SAVED_A_TRAP_VECTOR PROC
- Move.L A0,-(A7)
- Lea MASTER_A_TRAP,A0
- AddQ.L #4,A0
- Move.L (A0),D0
- Move.L (A7)+,A0
- RTS
- ENDPROC
-
-
-
-
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- ;• •
- ;• Identifier: SET_JUMP_TRACE_BIT and CLEAR_JUMP_TRACE_BIT •
- ;• ----------- •
- ;• •
- ;• Description •
- ;• ----------- •
- ;• These procs set and clear the jump-trace bit of the status register.•
- ;• •
- ;• History •
- ;• ------- •
- ;• •
- ;• Author Date Description •
- ;• ------------------------------------------------------------------ •
- ;• Kevin McEntee 2/20/90 Original Implementation •
- ;• •
- ;• •
- ;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
- SET_JUMP_TRACE_BIT PROC
- Ori.w #$4000,SR
- RTS
- ENDPROC
-
- CLEAR_JUMP_TRACE_BIT PROC
- Andi.w #$BFFF,SR
- RTS
- ENDPROC
-
- END
-